import pygame
import sys
import random

pygame.init()

screen = pygame.display.set_mode((800,600))

WHITE = (255,255,255)
BLACK = (0,0,0)

block_size = 30

UP = 0
RIGHT = 1
DOWN = 2
LEFT = 3

shapes = [
    [[1,1,1],[0,1,0]],
    [[0,1,1],[1,1,0]],
    [[1,1,0],[0,1,1]],
    [[1,1],[1,1]],
    [[1,1,0],[1,1]],
    [[1,1,1]],
    [[1,1,1],[1,0,0]],
]

def new_block():
    shape = random.choice(shapes)
    block = pygame.Surface(len(shape[0]))*block_size,len(shape)*block_size
    block.fill(WHITE)
    for y, row in enumerate(shape):
        for x, cell in enumerate(row):
            if cell:
                pygame.draw.rect(block,BLACK,(x * block_size,y * block_size,block_size,block_size),1)
    return block

while True:
    for event in pygame.event.get():
        if event.type == pygame.QUIT:
            sys.exit()

screen.fill(WHILT)

block = new_block()
screen.blit(block,(300,300))

pygame.display.flip()